package cn.cj.erp.bo.system;

import cn.cj.erp.common.SearchParam;
import cn.cj.erp.common.annotation.Search;
import cn.cj.erp.common.enums.SearchType;
import cn.cj.erp.common.enums.YesNoEnum;
import cn.cj.erp.common.excel.anno.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 系统配置信息
 * @author chenjian
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SysConfigBo extends SearchParam {
    /** 参数配置表ID */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 参数键名 */
    @NotBlank(message = "参数键名不能为空")
    @Excel(name = "参数键名")
    @Search(type = SearchType.LIKE)
    private String configKey;

    /** 参数名称 */
    @NotBlank(message = "参数名不能为空")
    @Excel(name = "参数名称")
    @Search(type = SearchType.LIKE)
    private String configName;

    /** 参数键值 */
    @NotBlank(message = "参数键值不能为空")
    @Excel(name = "参数键值")
    @Search
    private String configValue;

    /** 系统内置（1是 0否） */
    @Excel(name = "是否内置", combo = {"是", "否"})
    @Search
    private YesNoEnum internal;

    /** 备注 */
    @Excel(name = "备注", align = HorizontalAlignment.LEFT, width = 24)
    private String remark;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /** 修改时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date modifyTime;

    /** 修改时间开始，仅搜索 */
    @Search(type = SearchType.BETWEEN_BEGIN, fieldName = "modify_time")
    private Date beginTime;

    /** 修改时间结束，仅搜索 */
    @Search(type = SearchType.BETWEEN_END, fieldName = "modify_time")
    private Date endTime;
}
